﻿#ifndef U_TaskReceiver_H
#define U_TaskReceiver_H

#include "../Window/mainwindow.h"
#include "Console/myobject.h"
#include "Console/Server/SerialPort.h"
#include "agreement.h"
#include "Console/tables.h"
#include "Console/sqlbase.h"

class MainWindow;
class TaskReceiver : public MyObject
{
    Q_OBJECT
public:
    explicit TaskReceiver(int index, QObject *parent = nullptr);

signals:
    void recvData(float in,float ref,quint8 devid);
public slots:
    void Start();
    void Stop();
    void OnTimer();

    void ReadData(QByteArray data);
    bool IsLittleEndian();
    void SaveData();

    bool SetCmd(Instruction cmd);

public:
    SerialPort  *serialPort;

    Equipment   *equipment;
    Simulation  *simData;
    FrameFormat *format;
    State        *state;
    SqlBase     *sqlbase;
    QTimer      *timerSave;
};

#endif // U_TaskReceiver_H
